@import '../style/var';
@import '../style/mixins/clearfix';

.van-sku {
  &-container {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    min-height: 50%;
    max-height: 80%;
    overflow-y: visible;
    font-size: @font-size-md;
    background: @white;
  }

  &-body {
    flex: 1 1 auto;
    min-height: 44px;
    overflow-y: scroll;
    -webkit-overflow-scrolling: touch;

    &::-webkit-scrollbar {
      display: none;
    }
  }

  /* sku header */
  &-header {
    margin-left: @padding-md;

    &__img-wrap {
      position: relative;
      float: left;
      width: 96px;
      height: 96px;
      margin: @padding-sm 0;
      overflow: hidden;
      background: @background-color;
      border-radius: @border-radius-md;

      img {
        position: absolute;
        top: 0;
        right: 0;
        bottom: 0;
        left: 0;
        max-width: 100%;
        max-height: 100%;
        margin: auto;
      }
    }

    &__goods-info {
      display: flex;
      flex-direction: column;
      justify-content: flex-end;
      min-height: 96px;
      padding: @padding-sm 36px @padding-sm @padding-xs;
      overflow: hidden;
    }
  }

  &-header-item {
    margin-top: @padding-xs;
    color: @gray-6;
    font-size: @font-size-sm;
    line-height: 16px;
  }

  &__price-symbol {
    font-size: @font-size-lg;
    vertical-align: middle;
  }

  &__price-num {
    font-weight: @font-weight-bold;
    font-size: 22px;
    vertical-align: middle;
    word-wrap: break-word;
  }

  &__goods-price {
    color: @red;
  }

  &__price-tag {
    position: relative;
    display: inline-block;
    margin-left: @padding-xs;
    padding: 0 5px;
    overflow: hidden;
    color: @red;
    font-size: @font-size-sm;
    line-height: 16px;
    vertical-align: middle;
    border-radius: 8px;

    &::before {
      position: absolute;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      background: currentColor;
      opacity: 0.1;
      content: '';
    }
  }

  &-group-container {
    margin-left: @padding-md;
    padding: @padding-sm 0 2px;

    &--hide-soldout {
      .van-sku-row__item--disabled {
        display: none;
      }
    }
  }

  /* sku row */
  &-row {
    margin: 0 3px @padding-sm 0;

    &:last-child {
      margin-bottom: 0;
    }

    &__title {
      padding-bottom: @padding-sm;
    }

    &__title-multiple {
      color: @gray-6;
    }

    &__item {
      position: relative;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      min-width: 40px;
      margin: 0 @padding-sm @padding-sm 0;
      overflow: hidden;
      color: @text-color;
      font-size: 13px;
      line-height: 16px;
      vertical-align: middle;
      border-radius: @border-radius-md;
      cursor: pointer;

      &::before {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: @sku-item-background-color;
        content: '';
      }

      &-img {
        z-index: 1;
        width: 24px;
        height: 24px;
        margin: 4px 0 4px 4px;
        object-fit: cover;
        border-radius: @border-radius-sm;
      }

      &-name {
        z-index: 1;
        padding: @padding-xs;
      }

      &--active {
        color: @red;

        &::before {
          background: currentColor;
          opacity: 0.1;
        }
      }

      &--disabled {
        color: @gray-5;
        background: @active-color;
        cursor: not-allowed;

        .van-sku-row__item-img {
          opacity: 0.3;
        }
      }
    }
  }

  /* sku stepper */
  &-stepper {
    &-stock {
      margin-left: @padding-md;
      padding: @padding-sm 0;
    }

    &-container {
      min-height: 30px;
      margin-right: 20px;
      overflow: hidden;
    }
  }

  &__stepper {
    float: right;
    padding-left: @padding-base;

    &-title {
      float: left;
      line-height: 30px;
    }

    &-quota {
      display: inline-block;
      float: right;
      color: @red;
      font-size: @font-size-sm;
      line-height: 30px;
    }
  }

  &__stock {
    display: inline-block;
    margin-right: @padding-xs;
    color: @gray-6;
    font-size: @font-size-sm;

    &-num--highlight {
      color: @red;
    }
  }

  &-messages {
    padding-bottom: @padding-xl;

    &__image-cell {
      .van-cell__title {
        max-width: 90px;
      }

      .van-cell__value {
        overflow: visible;
        text-align: left;
      }
    }
  }

  &-img-uploader {
    display: inline-block;

    &__uploader {
      vertical-align: middle;
    }

    &__img {
      position: relative;
      float: left;
      width: 64px;
      height: 64px;
      margin-right: @padding-xs;
      background: @sku-item-background-color;
      border-radius: @border-radius-sm;

      img {
        width: 100%;
        height: 100%;
        object-fit: contain;
      }
    }

    &__delete {
      position: absolute;
      top: -12px;
      right: -14px;
      z-index: 1;
      padding: 6px;
      color: @sku-upload-mask-color;
      opacity: 0.8;

      &::before {
        background-color: @white;
        border-radius: 14px;
      }
    }

    &__mask {
      position: absolute;
      top: 0;
      left: 0;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      width: 100%;
      height: 100%;
      color: white;
      background: @sku-upload-mask-color;
    }

    &__warn-text {
      margin-top: 6px;
      font-size: @font-size-sm;
      line-height: 14px;
    }

    &__trigger {
      display: flex;
      align-items: center;
      justify-content: center;
      width: 100%;
      height: 100%;
      color: @sku-icon-gray-color;
    }
  }

  &-actions {
    display: flex;
    flex-shrink: 0;
    padding: @padding-xs @padding-md;

    .van-button {
      height: 40px;
      font-weight: @font-weight-bold;
      font-size: @font-size-md;
      line-height: 34px;
      border: none;
      border-radius: 0;

      &:first-of-type {
        border-top-left-radius: 20px;
        border-bottom-left-radius: 20px;
      }

      &:last-of-type {
        border-top-right-radius: 20px;
        border-bottom-right-radius: 20px;
      }

      &--warning {
        background: @gradient-orange;
      }

      &--danger {
        background: @gradient-red;
      }
    }
  }
}
